import  React from 'react';
import request from '../../../assets/js/utils/request';
import Css from '../../../assets/css/home/goods/index.css';
import {LocalParam} from "../../../assets/js/utils";
class goodsDetails extends React.Component{
    constructor(props){
        super(props);
        this.state={
            aBody:'',
            gid:props.location.search!==''?LocalParam(props.location.search).search:'',
        }
    }
    componentDidMount(){
        request(window.base.config.baseUrl+'/home/goods/info?gid='+this.state.gid.gid+'&type=details&token='+window.base.config.token,'get').then((res)=>{
            if(res.code===200){
                this.setState({aBody:res.data.bodys})
            }
        })
    }
    //解决页面离开时异步发生的内存泄漏
    componentWillUnmount(){
        this.setState=(state,callback)=>{
            return;
        }
    }
    render(){
        return(
            <div className={Css['details']}>
                <div dangerouslySetInnerHTML={{__html:this.state.aBody}}></div>
            </div>
        )
    }
}
export default goodsDetails